package com.ssy.lingxi.product.api.model.response.commodity;

import com.ssy.lingxi.product.api.model.response.SimpleCustomerAttributeResponse;
import com.ssy.lingxi.product.api.model.response.SimpleCustomerAttributeValueResponse;
import lombok.Data;

import java.io.Serializable;
import java.util.List;
import java.util.Objects;

/**
 * 商品属性响应类
 * @author jw.chen
 * @version 2.0.0
 * @date 2020/6/28
 */
@Data
public class CommodityAttributeResponse implements Serializable {
    private static final long serialVersionUID = -1105287948934483380L;
    /**
     * 主键id
     */
    private Long id;

    /**
     * 会员属性
     */
    private SimpleCustomerAttributeResponse customerAttribute;

    /**
     * 会员属性值
     */
    private List<SimpleCustomerAttributeValueResponse> customerAttributeValueList;

    /**
     * 排序
     */
    private Integer sort;

    public Integer getSort() {
        return Objects.nonNull(customerAttribute) && Objects.nonNull(customerAttribute.getSort()) ? this.sort = customerAttribute.getSort() : Integer.MAX_VALUE;
    }
}
